
package com.lk.lkappearance.controller;

import com.lk.lkappearance.common.AbstractBaseController;
import com.lk.lkappearance.model.Meter;
import com.lk.lkappearance.model.MeterParameter;
import com.lk.lkappearance.service.MeterParameterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("/api/meterParam")
public class MeterParameterController extends AbstractBaseController {

    @Autowired
    private MeterParameterService meterParameterService;

    /**
     *
     * @param meterParameter
     * @return
     */
    @RequestMapping(value="/getList" , method = RequestMethod.GET)
    public Map<String,Object> getList(@RequestBody MeterParameter meterParameter){
        log.info("获取仪表参数列表");
        return meterParameterService.getList(meterParameter);
    }

    /**
     * @param meterParamId
     * @return
     */
    @RequestMapping(value="/getByPrimaryKey", method = RequestMethod.POST)
    public Map<String,Object> selectByPrimaryKey(@RequestParam String meterParamId){
        log.info("查看仪表参数");
        return meterParameterService.selectByPrimaryKey(meterParamId);
    }

    /**
     *
     * @param meterParameter
     * @return
     */
    @RequestMapping(value = "/add", method = RequestMethod.POST)
    public Map<String,Object> add(@RequestBody MeterParameter meterParameter){
        log.info("添加仪表参数");
        return meterParameterService.add(meterParameter);
    }

    /**
     *
     * @param meterParameter
     * @return
     */
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Map<String,Object> update(@RequestBody MeterParameter meterParameter){
        log.info("修改仪表参数");
        return meterParameterService.modify(meterParameter);
    }

    /**
     *
     * @param meterParamId
     * @return
     */
    @RequestMapping(value = "/del", method = RequestMethod.POST)
    public Map<String,Object> delete(@RequestBody String meterParamId){
        log.info("根据主键删除仪表参数");
        return meterParameterService.delete(meterParamId);
    }

    /**
     *
     * @param meterList
     * @return
     */
    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
    public Map<String,Object> insertList(@RequestBody List<MeterParameter> meterList){
        log.info("导入");
        return meterParameterService.insertListExcel(meterList);
    }

    /**
     * @param meterParameter
     * @return
     */
    @RequestMapping(value="/exportExcel", method = RequestMethod.GET)
    public Map<String,Object> getListExcel(@RequestBody MeterParameter meterParameter){
        log.info("导出");
        return meterParameterService.exportExcel(meterParameter);
    }
    
    
}
